package singleTon;

//单例模式：懒汉式
public class singleTon02 {

    //私有化构造器
    private singleTon02(){}

    //提供一个静态属性，类型是singleTon02
    private static singleTon02 instance;

    //提供一个公开的静态方法，返回静态属性instance
    public static singleTon02 getInstance(){
        if (instance == null){
            instance = new singleTon02();
        }
        return instance;
    }
}
